<!-- 评论列表  分页 -->
<!-- 本样式要引入 jquery.min.js   kindeditor  layer -->
<!--可接收参数 topicId:话题Id  commentId:评论Id  page:分页-->
<!--<@function topicId="${url_topicId}" commentId="${url_commentId}" page="${url_page}" >-->

<th:block th:if="${commentList!=null}">
	
	<div class="commentModule" >
		<ol class="commentList" >
			<!-- #comment-## -->
				<div class="commentInfo" th:each="comment:${commentList}" th:id="'anchor_'+${comment.id}">
					<div class="comment-author">
						<a th:href="@{'/user/control/home?userName='+${comment.username}}" >
							<img th:if="${comment.avatarName != null}" th:src="@{'/readImg'+${comment.avatarName}}">

							<img th:if="${comment.avatarName==null}" th:avatar="${comment.nikename}"/>
						</a>
						<cite>
							<a th:href="@{'/user/control/home?userName='+${comment.username}}" th:text="${comment.nikename}">
							</a>
<!--							<#if comment.isStaff>-->
<!--								<span class="staff">官方人员</span>-->
<!--							</#if>-->
						</cite> 
					</div>
					<div class="commentTime" th:text="${#dates.format(comment.createTime, 'yyyy-MM-dd HH:mm:ss')}"></div>
					<div class="commentContent" th:utext="${comment.commentContent}"></div>
					<div class="clearfix"></div>

						<div class="replyList" th:if="${comment.replyList.size()>0}">
							<ul class="box" th:each="reply:${comment.replyList}">
									<li>
										
								        <div class="reply-top" >
											<a class="avatarBox" th:href="@{'/user/control/home?userName='+${reply.username}}" >
												<img th:if="${reply.avatarName != null}" th:src="@{'/readImg'+${reply.avatarName}}">

												<!-- 首字符头像-->
												<img th:if="${reply.avatarName==null}" th:avatar="${reply.nikename}"/>
											</a>
									    	<a class="userName" th:href="@{'/user/control/home?userName='+${reply.username}}" th:text="${reply.nikename}">
											</a>
<!--											<#if reply.isStaff>-->
<!--												<div class="userTag">-->
<!--										        	<span class="staff">官方人员</span>-->
<!--									        	</div>-->
<!--											</#if>-->

											
											<span class="time" th:text="${#dates.format(reply.createTime, 'yyyy-MM-dd HH:mm:ss')}">

											</span>
										</div>
										<div style="clear:both; height: 0; line-height: 0; font-size: 0;"></div>
										<div th:id="'editCommentReply-replyContent_'+${reply.id}" class="replyContent" th:text="${reply.commentContent}"></div>
										<div th:id="'editCommentReply-post_'+${reply.id}" ></div>
									</li>

							</ul>
						</div> 

					<div th:id="'commentReply-post_'+${comment.id}" class="commentReply-post">
					</div>

					<div class="tipBottom">
						<span class="a-toolbar" >
							<a href="javascript:"  th:onclick="replyLayer('[[${comment.id}]]',[[${comment.nikename}]]);">回复</a>&nbsp;

							<!-- 是否登录 -->
							<input type="hidden" id="isLogin" th:value="${session.userList!=null}?true : false">

						</span>
					</div>
				</div>
		</ol>
		<div class="commentPage" th:if="${pageView.totalrecord!=0}">

			<div th:include="public/newPublic_1"></div>

		</div>
	</div>
</th:block>



<script type="text/javascript" th:inline="javascript">
	/*<![CDATA[*/
	var url = [[@{'/user/'}]];
	/*]]>*/

//滚动到描点(当上级跳转来后台'我的评论' '我的回复'时)
$(function() {
	var commentId = getUrlParam("commentId");//URL中的评论Id
	if(commentId != null && commentId != ""){
		var anchor = $("#anchor_" + commentId); //获得锚点   
		
	    if (anchor.length > 0) {//判断对象是否存在   
	        var pos = anchor.offset().top;  
	      //  var poshigh = anchor.height();  
	        $("html,body").animate({ scrollTop: pos }, 500);  
	    }
	}
     
 });  


//回复展开层
function replyLayer(commentId,userName){
	//判断是否已登录
	var isLogin = document.getElementById("isLogin").value;
	if(isLogin == "false"){
		layer.open({
		    type: 1, 
		    title:"提示",
		    content: "<div style='line-height: 36px; font-size: 15px;text-align:center; margin-left: 8px;margin-right: 8px;'>请先登录</div>", 
		    area: ['260px', '120px'],//宽高
			success: function(layero, index){
				 
			}
		});
		return false;
	}
	
	var parameter = "";//URI参数
	parameter += "commentId="+commentId;
	
	
	//回复页面
	get_request(function(value){
		if(value != ""){
			$("#commentReply-post_"+commentId).html(value);
		}
	},
	url+"editCommentReply?"+parameter, true);
	
}
function cancelReply(commentId){
	$("#commentReply-post_"+commentId).html("");
}



</script> 

